﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Topshelf;

namespace Stardance.ProgramTimer
{
    class Program
    {
        static void Main(string[] args)
        {
            HostFactory.Run((x) =>
            {
                x.Service<RecordManager>(s =>
                {
                    s.ConstructUsing(name => new RecordManager());
                    s.WhenStarted(tc =>  tc.OnStart());
                    s.WhenStopped(tc => tc.OnStop());
                    s.WhenShutdown(tc => tc.OnShutDown());
                });
                x.RunAsLocalSystem();
                x.SetDescription("统计应用程序运行总时间");
                x.SetDisplayName("ProgramTimer");
                x.SetServiceName("ProgramTimerWatcher");
            });
        }
    }
}
